<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var mArray = sessionStorage.getItem("123");

    if(mArray==null){
        mArray = new Array();
    }else {
        mArray = JSON.parse(mArray)
    }
    mArray.push(7);
    sessionStorage.setItem("123",JSON.stringify(mArray));
    mArray = JSON.parse(sessionStorage.getItem("123"));
    mArray.slice(-7,-1)
    console.log(mArray);
    console.log(mArray.slice(-5));


</script>
</body>
</html>